import request from '@/utils/request'

// 查询区域
export function getArea (data) {
  return request({
    url: '/category/getPage',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}



// 新增区域
export function addAreaBtn (data) {
  return request({
    url: '/category/addCategory',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 修改区域
export function changeAreaBtn (data) {
  return request({
    url: '/category/updateCategory',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除区域
export function deleteArea (data) {
  return request({
    url: '/category/delCategory',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 查询校区
export function getCampus (data) {
  return request({
    url: '/campus/getPage',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 查询校区下拉
export function getCampusOptions (data) {
  return request({
    url: '/campus/getList',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 新增校区
export function addCampusBtn (data) {
  return request({
    url: '/campus/addCampus',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 修改校区
export function changeCampusBtn (data) {
  return request({
    url: '/campus/updateCampus',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除校区
export function deleteCampus (data) {
  return request({
    url: '/campus/delCampus',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

//查询楼栋
export function getBuildings (data) {
  return request({
    url: '/building/getPage',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 修改楼栋
export function changeBuildingBtn (data) {
  return request({
    url: '/building/updateBuilding',
    method: 'post',
    data: data,
    headers: {
      'Content-Type': 'application/json',
      // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
// 新增楼栋
export function addBuildingBtn (data) {
  return request({
    url: '/building/addBuilding',
    method: 'post',
    data: data,
    headers: {
       'Content-Type': 'application/json',
     // 'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}

// 删除楼栋
export function deleteBuilding (data) {
  return request({
    url: '/building/delBuilding',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
// 查询楼栋下拉
export function getBuildingOptions (data) {
  return request({
    url: '/building/getListByCampusId',
    method: 'get',
    params: data,
    headers: {
      // 'Content-Type': 'application/json',
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': window.localStorage.getItem('token'),
    }
  })
}
